<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改画廊基本资料</title>
<link href="../style/css_member.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/common.js"></script>
<script src="../js/artDialog.js?skin=gray"></script>
<script src="../js/artDialog.iframeTools.js"></script>
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>

<script type="text/javascript">

/**********提交前检查表单*****************/
function checkForm(){

	var name = $.trim($("#name").val());
	if( name  ==  ""){
		$("#name").focus();
		 alert("画廊名称不能为空。");
		 return false;
	}

	var description =  $.trim($("#description").val());
	if( description  ==  ""){
		$("#description").val("");
		$("#description").focus();
		alert("画廊简介不能为空。");
		return false;
	}

	var province = $("#provinceInfoSelect").val();
	if( province == ""){
		 alert("请选择所在省。");
		 return false;
	}

	var city = $("#cityInfoSelect").val();
	if( city == ""){
		 alert("请选择所在市。");
		 return false;
	}
	
	if(window.confirm("确认修改？")){
		$.ajax({
			type:'POST',
			url:'${ctx }/gallery/galleryAction!modify.do',
			async : false, //ajax同步
			data:$("#galleryForm").serialize(),//序列化表单里所有的内容
			success: function(data){
			  if(data =='0000'){
	    			alert("保存成功！");
	    			var win = art.dialog.open.origin;//来源页面
					win.location.reload();
					return false;
				}else{
					alert("保存失败！");
					return false;
				}
			}
		});
	}
}

$(function(){

	$("#galleryLink").click(function(){
		art.dialog.open('${ctx}/fileUpload!uploadPrepare.do?imgType=gallery&sharpId=9',{title:'修改画廊Logo图片',width:800,height:550,lock:true},false);
    });

	var city_id = '${gallery.cityInfo.id}';
	checkCity(city_id);
});

</script>
</head>

<body>

<form action="${ctx }/gallery/galleryAction!modify.do" method="post" id="galleryForm" name="galleryForm">
<table width="800" align="center" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
      <tr>
        <td bgcolor="#FFFFFF"><table width="800" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td align="center" class="bt14A" colspan="100%">填写画廊资料</td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 画廊名称：</td>
            <td class="bt14A"><input name="gallery.name" type="text" size="40" id="name" value="${gallery.name }"  maxlength="40"></td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 上传画廊logo：</td>
            <td class="bt14A"><span class="style18"><a id="galleryLink" style="cursor: pointer;color: red">上传</a></span></td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 画廊简介：</td>
            <td class="bt14A">
              <textarea name="gallery.description" cols="50" rows="5" id="description">${gallery.description }</textarea>
            </td>
          </tr>
          <tr>
            <td class="bt14A" align="right"><span class="style15">*</span> 所在地：</td>
            <td class="bt14A">
                <select name="gallery.provinceInfo.id" id="provinceInfoSelect" onchange="changeProvince()">
                        <option value="">选择省份</option>
                        <c:forEach items="${provinceInfoList}" var="provinceInfo" varStatus="status">
				            <option value="${provinceInfo.id}" <c:if test="${gallery.provinceInfo.id == provinceInfo.id }">selected="selected"</c:if>/> ${ provinceInfo.name}</option>
				        </c:forEach>
                </select>
                <select name="gallery.cityInfo.id" id="cityInfoSelect">
                  <option value="">选择县市</option>
                </select>
                <input name="gallery.address" type="text" size="40" id="address" value="${gallery.address }">
               </td>
          </tr>
          <tr>
            <td class="bt14A" align="right">业务联系人：</td>
            <td class="bt14A"><input name="gallery.contact" type="text" size="20" id="contact" value="${gallery.contact }"></td>
          </tr>
          <tr>
            <td class="bt14A"  align="right">咨询电话：</td>
            <td class="bt14A"><input name="gallery.tel" type="text" size="20" id="tel" value="${gallery.tel}">
            	<!-- 隐藏域 begin -->
		            <input name="gallery.imageInfo.id" type="hidden"  id="picImage" value="${gallery.imageInfo.id }">
		            <input name="gallery.id" type="hidden"  id="gallery_id" value="${gallery.id }">
		        <!-- 隐藏域 end --> 
            </td>
          </tr>
          <tr>
          	<td></td>
            <td class="nw12a" align="left">
           		 <img src="../images/an24.gif" width="114" height="31" onClick="javascript:checkForm()" style="cursor: pointer ;border: 0"></td>
          </tr>
        </table></td>
      </tr>
</table>
</form>
</body>
</html>